#include <stdio.h>

int a[100];
//快速排序实例
//left 是最左边的下标，我们在这里定义为1；
//right是最右边的下标，我们定义为数组的最大长度n
void quickSort(int left, int right){
    
    int refer, tmp, i, j;
    if (left > right) return;
    refer = a[left];//设置基准值
    //分别将左右下标赋值给i、j，方便后续指针移动
    i = left;
    j = right;
    while (i != j){
        //顺序很重要，先从右往左寻找
        while (a[j] >= refer && i < j){
            j --;
        }
        //从左往右寻找
        while (a[i] <= refer && i < j){
            i ++;
        }

        //剩下的就是满足条件的，我们互相交换
        if (i < j){
            tmp = a[i];
            a[i] = a[j];
            a[j] = tmp;
        }
    }
    //将基准数归位，这样基准数左边就全部小于基准数，基准数右边就全部大于基准数
    a[left] = a[i];
    a[i] = refer;
    //递归调用                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
    quickSort(left, i - 1);//左边递归
    quickSort(i + 1, right);//右边递归
}
int main() {
    for (int i = 1; i <= 6; i ++){
        scanf("%d", &a[i]);
    }
    quickSort(1, 6);
    for (int i = 1; i <= 6; i++){
        printf("%d ",a[i]);
    }
    return 0;
}